home *** CD-ROM | disk | FTP | other *** search
- Path: fontina.cs.wisc.edu!flisakow
- From: flisakow@fontina.cs.wisc.edu (Shaun Flisakowski)
- Newsgroups: comp.lang.c,comp.programming
- Subject: Re: Trying to store a triangular matrix
- Followup-To: comp.programming
- Date: 19 Jan 1996 08:38:14 GMT
- Organization: U of Wisconsin CS Dept
- Message-ID: <4dnl9m$532@spool.cs.wisc.edu>
- References: <sksen.821949883@merle>
- NNTP-Posting-Host: fontina.cs.wisc.edu
-
- In article <sksen.821949883@merle>, Subhro Sen <sen@nwu.edu> wrote:
- >
- >I am trying to store a 2D lower triangular N x N matrix in
- >a 1D array...in other words i want A[i][j] to
- >map to some index m. What's the formula!?!?!
- >It's a lower triangular matrix, (A[i][j] = 0 for j > i)
- >i.e.:
- >
- >
- >1 0 0 0
- >2 1 0 0
- >5 3 2 0
- >9 3 4 1
- >
-
- addr = 2^i + j - 1
-
- Where ^ is used to indicate power-of, and not C's xor.
-
- Followups set to comp.programming, as this has nothing to do with C.
-
- --
- Shaun flisakow@cs.wisc.edu
-
- "In your heart you know its flat."
- -Flat Earth Society
-